//package com.matt.controller.pad;
//
//import com.matt.commons.dto.sso.StaffDTO;
//import com.matt.commons.model.StatusResponse;
//import com.matt.commons.utils.JsonUtil;
//import com.matt.foundation.DO.UserMessageDo;
//import com.matt.foundation.model.MemVerificationCache;
//import com.matt.service.PhoneUserService;
//import com.matt.service.remoteCall.SsoCallService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestHeader;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//;
//
///**
// * @Describle This Class Is 老师端麦信
// * @Author ZengMin
// * @Date 2019/1/2 11:01
// * @Company Matt
// */
//@RestController
//@RequestMapping("/pad/msg")
//public class PadMessageController {
//
//    @Autowired
//    SsoCallService ssoCallService;
//
//    @Autowired
//    MemVerificationCache cache;
//
//    @Autowired
//    PhoneUserService phoneUserService;
//
//    private static final String MBP_SAVE_MSG = "/api/phone/msg//teach/sendMsg";
//    private static final String MBP_GET_MSG = "/api/phone/msg//teach/getMsg";
//    private static final String MBP_GET_MSGCOUNT = "/api/phone/msg/teach/getUnReadCount";
//    private static final String MBP_WITHDRAW_MSG = "/api/phone/msg/withdraw";
//
//
//    //老师获取通讯录
//    @RequestMapping("/teach/getDialogs")
//       public StatusResponse getDialogs(@RequestHeader String ticket) {
//        //根据老师id 取班级 取所有孩子 取所所有家长
//        return StatusResponse.success(phoneUserService.getAllUsersByTeacher(ticket));
//    }
//
//    @RequestMapping("/teach/getAreaDialogs")
//    public StatusResponse getAreaDialogs(@RequestHeader String ticket) {
//        //获取全园员工的通讯录
//        return StatusResponse.success(phoneUserService.getAllAreaUsers(ticket));
//    }
//
//    //老师发送消息
//    @RequestMapping("/teach/sendMsg")
//    public StatusResponse sendMsgTeach(@RequestHeader String ticket, UserMessageDo userMessage) {
//        StaffDTO staffBaseInfo = cache.getStaff(ticket);
//        //权限验证  只限制园长 班主任 任课老师发送消息  (能发消息的都是有权限的老师 此处无需验证)
////        Set<String> relChildrenTeacherIds = phoneUserService.getTeachersByChildrenId(userMessage.getCid());
////        if(!relChildrenTeacherIds.contains(staffbaseInfo.getId())){
////            throw new BusinessException(ErrorCode.NOT_ROLE_ERROR,"仅允许园长、班主任、任课老师发送消息");
////        }
//        userMessage.setTid(staffbaseInfo.getId());
//        userMessage.setTname(staffBaseInfo.getRealName());
//        String msgJson = JsonUtil.toJson(userMessage);
//      /*  UserMessageDo call = RemoteCallUtil.call(mbpUrl + MBP_SAVE_MSG, ImmutableMap.of("msgJson",msgJson), ticket, UserMessageDo.class, "麦宝+通讯异常");
//        return StatusResponse.success(call);*/
//        return null ;
//    }
//
//    //老师获取消息列表
//    @RequestMapping("/teach/getMsg")
//    public StatusResponse sendMsg(@RequestHeader String ticket , String cid, String uid, @RequestParam(defaultValue = "0") int start,@RequestParam(defaultValue = "10") int size) {
//    /*    HashMap call = RemoteCallUtil.call(mbpUrl + MBP_GET_MSG, ImmutableMap.of("cid", cid, "uid", uid, "start", start, "size", size),
//                ticket, HashMap.class, "麦宝+通讯异常");
//        return StatusResponse.success(call);*/
//        return null ;
//    }
//
//    //老师获取未读消息条数
//    @RequestMapping("/teach/getUnReadCount")
//    public StatusResponse getTeachUnReadCount(@RequestHeader String ticket,int type) {
//        /*String ids = ModelUtil.joinQuota(Lists.newArrayList(phoneUserService.getChildrensByStaffId(ticket)));
//        Object call = RemoteCallUtil.call(mbpUrl + MBP_GET_MSGCOUNT, ImmutableMap.of("type", type,"cids",ids),
//                ticket, Object.class, "麦宝+通讯异常");
//        return StatusResponse.success(call);*/
//        return null ;
//    }
//
//    //老师撤回消息
//    @RequestMapping("/teach/withdraw")
//    public StatusResponse Withdraw(String messageId) {
//  /*      Boolean aBoolean = RemoteCallUtil.call(mbpUrl + MBP_WITHDRAW_MSG, ImmutableMap.of("messageId", messageId), null, Boolean.class, "麦宝+通讯异常");
//        return StatusResponse.success(aBoolean);*/
//        return null ;
//    }
//
//}
